package com.example.springbootcondition;

import com.example.springbootcondition.domain.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class SpringbootConditionApplication {

    public static void main(String[] args) {

        //获取到了
        ConfigurableApplicationContext context = SpringApplication.run(SpringbootConditionApplication.class, args);

        //
        User user = (User) context.getBean("user2");
        System.out.println(user);
        //根据名字获取
        // RedisTemplate redisTemplate = (RedisTemplate) context.getBean("redisTemplate");
        // //
        // redisTemplate.opsForValue().set("aaa", "bbb");
        // System.out.println(redisTemplate.opsForValue().get("aaa"));
    }

}
